<?php

namespace App\DesignPatterns;

class ObserverTest extends \PHPUnit_Framework_TestCase
{
    protected $observer;

    public function __construct()
    {
        $this->observer = new UserObserver();
    }

    /**
     * 测试通知
     */
    public function testNotify()
    {
        $this->expectOutputString('DesignPatterns\Behavioral\Observer\User has been updated');
        $subject = new User();

        $subject->attach($this->observer);
        $subject->property = 123;
    }
}